<?php


namespace app\common\cachemodel;


use app\common\model\BaseCache;
use XznsTools\cache\CacheManage;

class GoddessBaseInfo extends BaseCache
{
    protected $table = 'wechatadmin.zl_goddess_base_info';
    protected $cacheModel = 'goddess.goddess_info';

    /**
     * 获取女神专区 女神信息
     * @param array $filed
     * @return array|bool|mixed
     * @throws \Exception
     */
    public function getInfo($filed = [])
    {
        $data = CacheManage::getInstance()->setCacheConfig($this->cacheModel, 1)
            ->getDataAndSet(function ()
            {
                try
                {
                    $data = $this->where('id', 1)
                        ->field('id,nickname,avatar,title1,notice_img1,target1,link1,title2,notice_img2,target2,link2,notice_img3,target3,link3,index_img,index_title,index_intro,index_target,index_link')
                        ->findOrFail()->toArray();
                }
                catch (\Exception $e)
                {
                    $data = [];
                }
                return $data;
            }, $filed);

        return $data;
    }
}
